#乳腺癌预测
from sklearn.datasets import load_breast_cancer
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
 
#准备数据
X,y = load_breast_cancer(return_X_y=True)
print(X.shape)
print(y.shape)

X_train,X_test,y_train,y_test = train_test_split(X,y,test_size=0.15)
 
#准备模型
lr = LogisticRegression(multi_class="multinomial")
 
#模型训练
lr.fit(X_train,y_train)
 
#模型评估
# 只有回归问题用mse,分类问题用accuracy_score
print(accuracy_score(y_test,lr.predict(X_test)))
 
#模型预测
#未来再来一位病人，可以预测其乳腺癌良恶性。此处可以先不使用。